home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / giochi / amigainf.lha / inform / release-note.txt < prev   
Text File  |  1995-08-02  |  21KB  |  547 lines

  1.  
  2.                      What's New in Inform 5.5, v1502
  3.                      -------------------------------
  4.                              (5 July 1995)
  5.  
  6.   Version 5.5 is the first upgrade of the Inform compiler to provide new
  7. features (rather than just fix bugs) for about 10 months.
  8.  
  9.   For the last year or so, my intention has been to keep the Inform language
  10. stable, but to continually enhance the library.  Although these additions do
  11. change the language, they are hopefully minor and logical, and several have
  12. long been asked for.  Inform 5.5 removes no features of 5.4 (except in so
  13. far as it tests for a few more definite errors, so some old but subtly wrong
  14. code may not compile: this is probably a good thing).  However, it does now
  15. produce warnings if the source code uses obselete features (leftovers from
  16. Inform 1 right up to those from Inform 5.4).  The new syntax is so much
  17. nicer that I suggest changing over to it rather than switching off these
  18. warnings at the command line.
  19.  
  20.   The short answer is: tidier object-name printing, more logical and flexible
  21. syntax for creating arrays, tables of data, slightly better grammar
  22. replacement, a switch statement and provision for compiling very much larger
  23. games (up to twice the size of the previous maximum, which was pretty huge
  24. anyway).
  25.  
  26.   *** It is recommended that Inform 5.5 should only be used with ***
  27.                 *** library release 5/10 and later ***
  28.  
  29. (there was a minor bug in 5/9 which can cause compilation errors: an
  30. example of "old but subtly wrong code").  In any case, accompanying this
  31. release is library 5/11.
  32.  
  33.  
  34. 0.  Bugs fixed from v1405 (all minor)
  35. -------------------------------------
  36.  
  37.   (a) comments caused problems when coming between a loop construct (e.g.
  38. "for (i=1:i<10:i++)") and its block of code.
  39.   (b) using the "box" command inside an embedded routine (which is seldom
  40. sensible, actually!) sometimes produced mysterious compilation errors.
  41.   (c) the code for explicitly-defined string constants, such as
  42.  
  43.           Constant Game "Lost Trifles of Bluffocom";
  44.  
  45. has been thoroughly rewritten, since the old method produced wrong
  46. results in some cases (such as if a global variable had been
  47. given as initial value a string, e.g. by: global Var="hello";).
  48.   (d) initial values like strings and dictionary words for global variables
  49. (at declaration time) now work properly.
  50.   (e) removal of a foolish restriction rather than bug: string constants
  51. had to be preceded by a # in usage, (e.g.  print #Dragons_Name;) for no
  52. good reason.  (E.g., print Dragons_Name;  now works.)
  53.   (f) the #r$RoutineName construction didn't work when RoutineName was
  54. within the first 256 bytes of the code area (only library internals live
  55. there, and this bug has never been observed in honest code!)
  56.   (g) actually, this is the same as in v. 5.4, but I seem to have forgotten
  57. to publicise it: the function  indirect(R);  (to call the function with
  58. address R, so for instance indirect(#r$MyFunction)) can now take an optional
  59. second and third argument.  indirect(R,x);  calls function R with one
  60. parameter, x, and  indirect(R,x,y);  calls it with two, x and y.
  61.   (h) the notoriously unhelpful (though happily rare) "a label has moved
  62. between passes" error message has been rewritten to suggest the likely
  63. cause: it now reads
  64.  
  65.           An error has occurred just before this point with what Inform
  66.           thought was a constant.  Perhaps it was a global variable used
  67.           before its definition in the code.
  68.  
  69.   (i) local variables can't be called "sp" (this is the name of the stack
  70. pointer, so crashes result) and an error is now produced if they are.
  71.  
  72. 0'.  Bugs fixed in, and additions made to, the beta-version
  73. -----------------------------------------------------------
  74.  
  75.   A beta-testing version of Inform 5.5 was (silently by me) put onto the
  76. archive for porters to experiment with (though in the event many other
  77. people found it).  This version, v1501, included a serious bug (l) and
  78. several improvements have been made since:
  79.  
  80.   (j) the assembly opcode @set_colour now works (actually, this bug is a
  81. year old, and was simultaneously found by two different people in the last
  82. couple of months).
  83.   (k) values in switch statements are now allowed to take the form "x to y"
  84. (for x<=v<=y), stolen from Modula-3 at Gareth Rees's suggestion.
  85.   (l) a bug in final file output caused incorrect game files to be
  86. produced if no version-number had been explicitly set (it now by default
  87. produces legal V5 files).
  88.   (m) details for the VMS port (for VAX or Alpha), the Linux, OS/2 and
  89. Mac ports have been updated; the latter now includes a Macintosh
  90. Programmer's Workshop version.
  91.   (n) it's difficult to compile dictionary words which contain apostrophes
  92. (e.g., words such as "jemima's") as constants under I5.4; under I5.5,
  93. apostrophes ' in dictionary words should now always be written with an ^. 
  94. For example, the constant 'isaac^s' refers to the word "isaac's".
  95.   (o) if you specify a property in an object description but give it no
  96. data values, I5.5 now supplies a 0 word as value (5.4 used to compile an
  97. empty list, which was logical but apt to confuse the interpreter).
  98.   (p) the grammar enhancements in (10) below were added.
  99.   (q) different file extensions for all of V3 to V8 inclusive can now be
  100. made, if the port makes suitable #defines in header.h.
  101.   (r) giving a non-default output filename at the command line didn't
  102. work in v1501, owing to a foolish bug.
  103.   (s) fuller details are given below of the V8 alterations needed to
  104. "Zip".
  105.   (t) overflow of the buffer used for text-transcription (to make "proofs"
  106. of the text in a game) is now checked for; previously this might have
  107. caused memory (typically the symbols table) to be corrupted on very large
  108. games when compiling with -r set.
  109.  
  110.  
  111. 1.  Printing
  112. ------------
  113.  
  114.   Recall that the "print" and "print_ret" commands take a list of items,
  115. separated by commas, printing each in turn.  (The latter then prints a
  116. new-line and returns true.)  The new preferred syntax for these items is one
  117. of:
  118.  
  119.       <expression>         print this number
  120.       "string"             print this string
  121.       char <expression>    print the character this is the ASCII code of
  122.       object <expression>  print the given object's true short name
  123.                            (this shouldn't be used except by the Library,
  124.                            as it will fail to notice the short_name routines
  125.                            many objects provide)
  126.       (the) expression     the definite article and short-name of this object
  127.       (The) expression     the same, but capitalising the definite article
  128.       (a) expression       the indefinite article and short-name
  129.       (name) expression    just the short-name
  130.       (char) expression    same as print char, for consistency
  131.       (number) expression  print the number but in words, not numerals
  132.       (string) expression  print the string at this (packed) address: good
  133.                                for printing out property values which are
  134.                                strings in double-quotes
  135.       (address) expression     print the string at this byte address: good
  136.                            for printing out dictionary words and little else
  137.       (Routine) expression     print nothing: but call   Routine(expression)
  138.                            in the expectation that it will print something
  139.  
  140. These new features are cosmetic, but considerably tidy the look of code. 
  141. E.g., one would write
  142.  
  143.       print_ret (The) x1, " explodes messily.  Perhaps it was unwise to \
  144.                 drop it into ", (the) x2, ".";
  145.  
  146. to produce, say,
  147.  
  148.       The hand grenade explodes messily.  Perhaps it was unwise to drop
  149.       it into the glassworks.
  150.  
  151. whereas in 5.4 it would have to have been
  152.  
  153.       CDefArt(x1); print " explodes messily.  Perhaps it was unwise to \
  154.       drop it into "; DefArt(x2); ".";
  155.  
  156.  
  157. 2.  Global variables, tables and arrays
  158. ---------------------------------------
  159.  
  160.   The whole syntax for declaring global variables has been tidied up and
  161. extended.  The new syntax for declaring a variable "frotz" is:
  162.  
  163.       Global frotz;                                Ordinary variable, set to 0
  164.       Global frotz = <value>;                           ..., set to this value
  165.  
  166.       Global frotz <array-type> <array-data>;
  167.  
  168. But since one very rarely wants to change the value of "frotz" in this case
  169. (it will remain the address of the array throughout the game), the more usual
  170. course is to declare
  171.  
  172.       Array  frotz <array-type> <array-data>;
  173.  
  174. which is identical in effect, except that "frotz" is now a constant.  (This
  175. can be convenient: it can now be quoted in other array definitions, for
  176. instance, or as a property value.)
  177.  
  178. There are four types of array:
  179.  
  180.   Syntax    Pronounced     Contents
  181.  
  182.   ->        byte array     with entries written array->0 up to array->(n-1)
  183.                            (can hold chars and numbers between 0 and 255)
  184.  
  185.   -->       word array     with entries array-->0 up to array-->(n-1)
  186.                            (can hold any Inform number)
  187.  
  188.   string    string         a byte array, in which byte 0 holds the number of
  189.                            data entries in the array
  190.  
  191.   table     table          a word array, in which word 0 holds the number of
  192.                            data entries in the array
  193.  
  194. The array data can also be given in several ways:
  195.  
  196.   a single value   -   allocate this many zero entries;
  197.  
  198.   two or more values (divided by spaces)   -   these are the entries;
  199.  
  200.   a string in double-quotes   -   the entries are the ASCII values of the
  201.                                   characters of this string, in sequence;
  202.  
  203. or, as
  204.  
  205.   [;  <value-1>; ....; <value-n>; ];
  206.  
  207. which makes the entries these given values.  Semicolons in between the braces
  208. are ignored.  (The usefulness of this is that very long declarations, which
  209. would otherwise overflow Inform source code lines, can be made.)
  210.  
  211. These initial values can be any legal constant (for the first time this
  212. allows dictionary words and routine names): e.g.,
  213.  
  214.       105   "a quoted string"   'c'   'dictionary'   #r$RoutineName
  215.  
  216.  
  217. For instance,
  218.  
  219.       Array frotz -> 20;
  220.  
  221. makes an array of 20 bytes, entries of which can be read or written as
  222. frotz->0 ... frotz->19.  The initial values are all zero.  Whereas:
  223.  
  224.       Array frotz -> 4 8 12 16 20;
  225.  
  226. makes an array of 5 bytes, initially holding these five values.
  227.  
  228.       Array colours --> "Red" "Yellow" "Blue";
  229.       ...
  230.       print (string) colours-->1;
  231.  
  232. will print "Yellow".
  233.  
  234.       Array frotz string "blorple";
  235.  
  236. makes frotz point to an array with contents
  237.  
  238.       7  'b'  'l'  'o'  'r'  'p'  'l'  'e'
  239.  
  240. (This differs from  Array frotz -> "blorple"  in creating the initial 7.)
  241.  
  242.  
  243. A typical large table might have the form of:
  244.  
  245.       Array Holidays table
  246.       [;  "New Year's Day"  "Twelfth Night";
  247.           "Ash Wednesday"   "Good Friday";
  248.           "Martin Luther King Day";
  249.       ];
  250.  
  251. For instance, the names of songs played by the radio in "Curses" occupies a
  252. (pretty enormous) table, and
  253.  
  254.       print (string) RadioSongs-->(random(RadioSongs-->0));
  255.  
  256. prints out a random name from it.
  257.  
  258.  
  259.   In older versions of Inform the keywords "data", "initial" and "initstr"
  260. would have been used to initialise byte arrays suitably, and (annoyingly)
  261. word arrays couldn't be initialised to non-zero values at all.  These
  262. keywords still work, but are no longer needed.
  263.  
  264.  
  265. 3.  Function calls
  266. ------------------
  267.  
  268.   Can now take up to 7 arguments, instead of being restricted to 3.
  269. (Except in version-3 games, but I hope everyone's gone over to Advanced
  270. (version-5) now.)
  271.  
  272.  
  273.  
  274. 4.  Switch statements
  275. ---------------------
  276.  
  277.   Inform now has a "switch" statement similar to that of C.  That is,
  278.  
  279.       switch(expression)
  280.       {   value1: ...
  281.           value2: ...
  282.              ...
  283.           default: ...
  284.       }
  285.  
  286. evaluates the expression, and executes the first ... code if it has value1,
  287. the second ... if it has value2, and so on: if it has none of the values
  288. given, the default ... code is run.  (The "default" clause is optional,
  289. but if present must be the last clause.)
  290.  
  291.   (Unlike in C, there is no "case fall-through"; that is, once the value1
  292. code is executed, control automatically resumes from after the end of the
  293. switch statement.)
  294.  
  295.   Each value can in fact be a list of values, comma-separated.  A value
  296. can either be a single Inform constant or something in the form
  297.  
  298.           constant1 to constant2
  299.  
  300. (the range being inclusive).  So, for example:
  301.  
  302.       switch(random(6))
  303.       {   1: "A snake slithers.";
  304.           2 to 4: "An elephant bellows.";
  305.           default: "The jungle is ominously silent.";
  306.       }
  307.  
  308.   The "default" clause can now also be put into embedded routines, like
  309. before rules.  So, for instance, a room can have the "before" value
  310.  
  311.       before
  312.       [;  Jump: "The ceiling is too low.";
  313.           Look, Inv, Wait: ;
  314.           default: "An invisible force holds you inactive.";
  315.       ];
  316.  
  317. and the "default" rule is run if none of the others are.  Note that the
  318. Look, Inv and Wait actions are unaffected as we have explicitly done nothing
  319. to them.
  320.  
  321.  
  322. 5.  Abbreviate directive
  323. ------------------------
  324.  
  325.   The Abbreviate directive can now take a list of abbreviation strings, not
  326. just one at a time (and this saves writing out "Abbreviate" 64 times).  E.g.
  327.  
  328.       Abbreviate
  329.            ". " ", " " the " "The" "You" "ing" "you" "and" "ight" "with"
  330.            "all" "'s no" "which" "It is" " th" " no" "t o" "e s" "e i"
  331.            " to" "e o" "e a" " ma" "t i" " fi" "e w" " for" " con" " ba"
  332.            "d o" " ro" " di" " can" " lo" "t s" "t w" " com" " ho"
  333.            " ga" "tion" " from" " ha" "ter" " ea" "This" " hi" " pr" " un"
  334.            "d s" " fa" "urs" "'s ~" " ex" "der" "d a" " gr" " cl"
  335.            "d i" " po" " door" "her" " a ";
  336.  
  337. is a plausible set of abbreviation strings, saving about 20K on a 256K game
  338. file when Inform is compiling with the "economy" switch -e set.
  339.  
  340.  
  341. 6.  Testing the version number
  342. ------------------------------
  343.  
  344.   A special rule now applies to the Ifdef directive.
  345.  
  346.       #Ifdef VN_****;
  347.       ...
  348.       #Endif;
  349.  
  350. where **** is the four-digit number n, will now compile the code ... exactly
  351. if the current Inform version number is at least n.  Thus,
  352.  
  353.       #Ifdef VN_1501; print "The all new Inform show!^"; #Endif;
  354.  
  355. compiles only under this and later updates.
  356.  
  357.  
  358. 7.  More flexible < > construct
  359. -------------------------------
  360.  
  361.   Previously, constructions like
  362.  
  363.       <Action noun second>; 
  364.  
  365. were rather restricted, in that Action always had to be an action name
  366. and noun and second couldn't be compound expressions.  The latter restriction
  367. is now removed, and the former almost so: if Action is given in brackets
  368. (...) then it's worked out as an expression in the usual way.  (Brackets
  369. are needed to tell Inform that the first word shouldn't be tested as a
  370. constant with ## in front, which is what it does with action names.)  So,
  371. for instance,
  372.  
  373.       << (magic_action(frotz_spell)) noun.door_dir memory.number >>;
  374.  
  375. will now compile.  All previously-allowed < > and << >> expressions should
  376. compile just as they always did.
  377.  
  378.  
  379. 8.  Versions 7 and 8
  380. --------------------
  381.  
  382.   Two new types of story file are implemented: versions 7 and 8, newly
  383. created for the purpose.  (Inform can produce version 6, but this isn't
  384. recommended for text-only games as version 6 is very hard to fully interpret
  385. because of complex graphical features.)
  386.  
  387.   Version 8 is the one recommended for use, if a game of over 256K is
  388. required: it runs up to 512K in length.  Inform syntax is fully portable
  389. between version-5 (the default) and version-8; all you need to do is to
  390. compile with -v8 set.
  391.  
  392.   At present versions 7 and 8 are not interpreted by the interpreters in
  393. public circulation.  However, V8 is particularly easy to add to Mark
  394. Howell's "Zip" interpreter; see the end of this file.  A fairly large V8
  395. file (a V8 form of the author's new game "Jigsaw") will soon be available
  396. for experiment.
  397.  
  398.   Support for these new versions should percolate through the public domain
  399. in due course, since it's so easily coded, but if you're in a hurry you need
  400. only distribute your game with a suitably doctored interpreter.
  401.  
  402.   It should be added that a 512K Inform game would be gargantuan, 2.5 times
  403. the size of "Curses" (which is itself large as games go) - easily large
  404. enough to code the entire Zork and Enchanter trilogies into one.
  405.  
  406.  
  407. 9.  At the command line, and file inclusion
  408. -------------------------------------------
  409.  
  410.   Apart from -v8 (and -v7), there are two new command line switches: to
  411. change the error message style to Microsoft standard format, and to suppress
  412. warnings about obselete usages.
  413.  
  414.   There is one new memory command, $huge, which is an abbreviation for
  415. lots of large memory settings and saves bother when games have become pretty
  416. enormous.
  417.  
  418.   If a command line argument begins with a plus sign +, then the rest of that
  419. word is taken to be a directory in which the Library can be found.  (This is
  420. convenient so that only one copy of the Library need be kept, which several
  421. projects in different directories can make use of.)  E.g., I use something
  422. like
  423.  
  424.   inform -Tdcx $huge +Library curses/curses games/curses.z5
  425.  
  426.  
  427.   The Include directive has a convenient new feature: if the file-name to
  428. include begins with a >, like so
  429.  
  430.   Include ">endgame";
  431.  
  432. then the file "endgame" is sought from the same directory as the one doing
  433. the inclusion.  (Otherwise, if it has a / in, it's treated literally, and if
  434. not it's sought from the library directory.)  This is much less trouble
  435. when a game's source code is segmented into many files, as it usually is
  436. for large projects.
  437.  
  438.  
  439. 10.  Grammar replacement
  440. ------------------------
  441.  
  442.   In library grammar, some verbs have many synonyms: for instance, 
  443.  
  444.      "attack" "break" "smash" "hit" "fight" "wreck" "crack"
  445.      "destroy" "murder" "kill" "torture" "punch" "thump"
  446.  
  447. are all treated as identical.  But you might want to distinguish between
  448. murder and lesser crimes.  For this, try
  449.  
  450.      Extend only "murder" "kill" replace
  451.            * animate -> Murder;
  452.  
  453. The keyword 'only' tells Inform to extract the two verbs "murder" and
  454. "kill".  These then become a new verb which is initially an identical copy
  455. of the old one, but then 'replace' tells Inform to throw that away in favour
  456. of an entirely new grammar.
  457.  
  458. Similarly,
  459.  
  460.      Extend only "get" * "with" "it" -> Sing;
  461.  
  462. makes "get" behave exactly like "take" (as usual) except that it also
  463. recognises "with it", so that "get with it" makes the player sing but "take
  464. with it" doesn't.
  465.  
  466.   You can now also add new verb synonyms.  For instance,
  467.  
  468.      Verb "acquire" "grab" = "take";
  469.  
  470. gives the "take" verb two new synonyms.
  471.  
  472.  
  473.  
  474. Appendix: Adding Version 8 support to the "Zip" interpreter
  475. -----------------------------------------------------------
  476.  
  477. Only one routine need be changed, "configure".  In my copy of the source (10
  478. March 93) it now looks as below (note that in my copy only one if statement
  479. has been added).
  480.  
  481.  
  482. /*
  483.  * configure
  484.  *
  485.  * Initialise global and type specific variables.
  486.  *
  487.  */
  488.  
  489. #ifdef __STDC__
  490. static void configure (zbyte_t min_version, zbyte_t max_version)
  491. #else
  492. static void configure (min_version, max_version)
  493. zbyte_t min_version;
  494. zbyte_t max_version;
  495. #endif
  496. {
  497.     zbyte_t header[PAGE_SIZE];
  498.  
  499.     read_page (0, header);
  500.     datap = header;
  501.  
  502.     h_type = get_byte (H_TYPE);
  503.  
  504.     if (h_type < V4) {
  505.         story_scaler = 2;
  506.         story_shift = 1;
  507.         property_mask = P3_MAX_PROPERTIES - 1;
  508.         property_size_mask = 0xe0;
  509.     } else {
  510.         story_scaler = 4;
  511.         story_shift = 2;
  512.         property_mask = P4_MAX_PROPERTIES - 1;
  513.         property_size_mask = 0x3f;
  514.     }
  515.  
  516.     if (h_type == 8)             /* This is my amendment for V8... */
  517.     {   h_type=V5;
  518.         story_scaler = 8;
  519.         story_shift = 3;
  520.     }                            /* ...ending here. */
  521.  
  522.     if (h_type < min_version || h_type > max_version
  523.         || (get_byte (H_CONFIG) & CONFIG_BYTE_SWAPPED))
  524.         fatal ("wrong game or version");
  525.  
  526.     h_config = get_byte (H_CONFIG);
  527.     h_version = get_word (H_VERSION);
  528.     h_data_size = get_word (H_DATA_SIZE);
  529.     h_start_pc = get_word (H_START_PC);
  530.     h_words_offset = get_word (H_WORDS_OFFSET);
  531.     h_objects_offset = get_word (H_OBJECTS_OFFSET);
  532.     h_globals_offset = get_word (H_GLOBALS_OFFSET);
  533.     h_restart_size = get_word (H_RESTART_SIZE);
  534.     h_flags = get_word (H_FLAGS);
  535.     h_synonyms_offset = get_word (H_SYNONYMS_OFFSET);
  536.     h_file_size = get_word (H_FILE_SIZE);
  537.     if (h_file_size == 0)
  538.         h_file_size = get_story_size ();
  539.     h_checksum = get_word (H_CHECKSUM);
  540.     h_alternate_alphabet_offset = get_word (H_ALTERNATE_ALPHABET_OFFSET);
  541.  
  542.     datap = NULL;
  543.  
  544. }/* configure */
  545.  
  546.  
  547.